using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;

namespace FsObserver
{
    public class AsyncEventArgs : EventArgs
    {
        public AsyncEventArgs(Delegate handler, int delay_ms, params object[] args)
        {
            this.timestamp = DateTime.Now;
            this.handler = handler;
            this.args = args;
            this.delay = delay_ms;
        }

        public AsyncEventArgs(DateTime timestamp, Delegate handler, int delay_ms, params object[] args)
            : this(handler, delay_ms, args)
        {
            this.timestamp = timestamp;
        }

        private int delay;
        public int Delay
        {
            get { return delay; }
        }

        private object[] args;
        public object[] Args 
        {
            get 
            {
                return args;
            }
        }

        private Delegate handler;
        public Delegate Handler
        {
            get { return handler; }
        }

        private DateTime timestamp;
        public DateTime TimeStamp
        {
            get { return timestamp; }
        }

        //static List<AsyncEventArgs> EventQueue = new List<AsyncEventArgs>();
        //static void EventTimer_Elapsed(object sender, ElapsedEventArgs e)
        //{
        //    ((Timer)sender).Enabled = false;
        //    for (int i = 0; i < EventQueue.Count; i++)
        //    {
        //        if (EventQueue[i].Timer == (Timer)sender)
        //        {
        //            EventQueue[i].Handler.DynamicInvoke(EventQueue[i].Args);
        //            EventQueue.RemoveAt(i);
        //            return;
        //        }
        //    }
        //}
    }
}
